package cn.sitedev.simplefactory.coursename;

import cn.sitedev.simplefactory.ICourse;
import cn.sitedev.simplefactory.JavaCourse;
import cn.sitedev.simplefactory.PythonCourse;

/**
 * @author qchen
 * @description
 * @date 2020/9/16 18:57
 */
public class CourseFactory {
    public ICourse create(String courseName) {
        if ("java".equals(courseName)) {
            return new JavaCourse();
        } else if ("python".equals(courseName)) {
            return new PythonCourse();
        } else {
            throw new RuntimeException("该课程不存在");
        }
    }
}
